package bairui.international.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import bairui.international.model.domain.jpa.TB_ProductCategory;
import bairui.international.model.domain.jpa.TB_ProductCategoryProperty;
import bairui.international.model.domain.jpa.TB_ProductProperty;
import bairui.international.model.domain.jpa.id.ID_ProductCategoryProperty;
import bairui.international.service.Service_ProductCategoryProperty;

/**
 * 
 * 【(产品分类属性)TB_ProductCategoryProperty】服务实现
 *
 * @generated
 * 
 * @see bairui.international.model.domain.jpa.TB_ProductCategoryProperty 模型
 * @see Service_ProductCategoryProperty 服务接口
 * @see BService_ProductCategoryPropertyImpl 服务实现基础
 *
 */
@Service
public class Service_ProductCategoryPropertyImpl extends BService_ProductCategoryPropertyImpl implements Service_ProductCategoryProperty {

	private TB_ProductCategoryProperty createInstance(ID_ProductCategoryProperty id){
		return dao.save(new TB_ProductCategoryProperty(
				new TB_ProductCategoryProperty.MustProperties() {
					@Override public ID_ProductCategoryProperty getId() {
						return id;
					}
				},
				new TB_ProductCategoryProperty.OptionalSingleProperties() {
				}
			));
	}
	
	@Override
	public TB_ProductCategoryProperty create(TB_ProductCategory productCategory, TB_ProductProperty productProperty) {
		return createInstance(new ID_ProductCategoryProperty(productProperty, productCategory));
	}

	@Override
	public List<TB_ProductCategoryProperty> create(TB_ProductCategory productCategory, List<TB_ProductProperty> productProperties) {
		List<TB_ProductCategoryProperty> beans = new ArrayList<>();
		for(TB_ProductProperty productProperty : productProperties){
			beans.add(create(productCategory, productProperty));
		}
		return beans;
	}

}
